package io.gitee.yth.design.pattern.test.core.pattern.structural.decorator.code.decorator;

import io.gitee.yth.design.pattern.test.core.pattern.structural.decorator.code.Drink;

/**
 * @author yth
 * @since 2023-04-26-16:18
 */
public class MilkDrink extends DrinkDecorator {

    public MilkDrink(Drink drink) {
        super(drink, "milk", 0.2);
    }

    /**
     * 自定义装饰逻辑
     */
    @Override
    public String getDescription() {
        return this.description + " " + super.getDescription();
    }

    /**
     * 自定义装饰逻辑
     */
    @Override
    public double getPrice() {
        System.out.println("unit milk price is 0.2 ...");
        return this.price + super.getPrice();
    }
}
